<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增教师档案管理')"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-record-add">
        <div class="form-group">
            <div class="col-sm-6">
                <label class="col-sm-3 control-label">照片：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="picture">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="picture" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">档案编号：</label>
                    <div class="col-sm-8">
                        <input name="recordNumber" class="form-control" type="text" required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">工号：</label>
                    <div class="col-sm-8">
                        <input name="teacherNumber" class="form-control" type="text" required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">姓名：</label>
                    <div class="col-sm-8">
                        <input name="teacherName" class="form-control" type="text" required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">职务：</label>
                    <div class="col-sm-8">
                        <select name="post" class="form-control m-b"
                                th:with="type=${@dict.getType('tms_teacher_post')}" required>
                            <option value=""></option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                    th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">性别：</label>
                    <div class="col-sm-8">
                        <select name="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                    th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">身份证号：</label>
                    <div class="col-sm-8">
                        <input name="idCard" class="form-control" type="text" required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">出生年月：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input name="birthday" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">电话号码：</label>
                    <div class="col-sm-8">
                        <input name="phoneNumber" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-6">
                <label class="col-sm-3 control-label is-required">家庭住址：</label>
                <div class="col-sm-8">
                    <input name="homeAddress" class="form-control" type="text" required>
                </div>
            </div>
            <div class="col-sm-6">
                <label class="col-sm-3 control-label is-required">户籍：</label>
                <div class="col-sm-8">
                    <input name="censusRegister" class="form-control" type="text" required>
                </div>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-6">
                <label class="col-sm-3 control-label is-required">毕业院校：</label>
                <div class="col-sm-8">
                    <input name="graduate" class="form-control" type="text" required>
                </div>
            </div>
            <div class="col-sm-6">
                <label class="col-sm-3 control-label is-required">学历：</label>
                <div class="col-sm-8">
                    <select name="education" class="form-control m-b"
                            th:with="type=${@dict.getType('tms_education_degree')}" required>
                        <option value=""></option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-4">
                <label class="col-sm-3 control-label is-required">紧急联系人：</label>
                <div class="col-sm-8">
                    <input name="emergencyContact" class="form-control" type="text" required>
                </div>
            </div>
            <div class="col-sm-4">
                <label class="col-sm-3 control-label is-required">关系：</label>
                <div class="col-sm-8">
                    <input name="relationship" class="form-control" type="text" required>
                </div>
            </div>
            <div class="col-sm-4">
                <label class="col-sm-3 control-label is-required">紧急联系电话：</label>
                <div class="col-sm-8">
                    <input name="emergencyPhone" class="form-control" type="text" required>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <input name="remark" class="form-control" type="text">
            </div>
        </div>
    </form>
</div>
<hr>
<div class="row">
    <div class="col-sm-offset-5 col-sm-10">
        <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存
        </button>&nbsp;
        <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭
        </button>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript">
    var prefix = ctx + "tms/record"
    $("#form-record-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-record-add').serialize());
        }
    }

    $("input[name='birthday']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $(".file-upload").fileinput({
        uploadUrl: ctx + 'common/upload',
        allowedFileExtensions: ['jpg','png'],//接收的文件后缀
        dropZoneTitle: "上传照片",
        maxFileCount: 1,
        autoReplace: true
    }).on('fileuploaded', function (event, data, previewId, index) {
        $("input[name='" + event.currentTarget.id + "']").val(data.response.url);
    }).on('fileremoved', function (event, id, index) {
        $("input[name='" + event.currentTarget.id + "']").val('')
    })
</script>
</body>
</html>